package com.csdn.springbootmybatis.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.Arrays;
import java.util.List;

/**
 * @Author: JLL
 * @Date: 2019/8/21 22:26
 */
@Controller
public class MainController {

    @RequestMapping(value = "index")
    public String index(){
        return "index";
    }


    @Autowired
    private ApplicationContext applicationContext;

    @GetMapping("/beanList")
    @ResponseBody
    public List<String> beanList(){
        return Arrays.asList(applicationContext.getBeanDefinitionNames());
    }

    @RequestMapping("/errorPage")
    public String errorPage(Model model){
        return "/errorPage";

    }






}
